package vn.easyticket.db.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table( name = "[dbo].[S001_SHOW]" )
public class S001_Show
extends AbstractEntity
{
    private final boolean DEFAULT_IS_CANCELLED = false;

    @Column( name = "ShowId" )
    @Id
    @GeneratedValue( strategy = GenerationType.IDENTITY )
    private Integer showId;

    @Column( name = "EventId", nullable = false )
    private int eventId;

    @Column( name = "ShowName", nullable = false )
    @Lob
    private String showName;

    @Column( name = "CreateDate", nullable = false )
    @Temporal( TemporalType.TIMESTAMP )
    private Date createDate;

    @Column( name = "Creator", nullable = false )
    private int creator;

    @Column( name = "StartDate", nullable = false )
    @Temporal( TemporalType.TIMESTAMP )
    private Date startDate;

    @Column( name = "EndDate", nullable = false )
    @Temporal( TemporalType.TIMESTAMP )
    private Date endDate;

    @Column( name = "CityId", nullable = false )
    private int cityId;

    @Column( name = "IsCancelled", nullable = false )
    private boolean isCancelled = DEFAULT_IS_CANCELLED;

    @Column( name = "ShowDetails", nullable = true )
    @Lob
    private String showDetails;

    public S001_Show()
    {
    }

    public S001_Show( Integer showId )
    {
        this.showId = showId;
    }

    public S001_Show( Integer showId, int eventId, String showName, Date createDate, int creator, Date startDate,
                 Date endDate, int cityId, boolean isCancelled )
    {
        this.showId = showId;
        this.eventId = eventId;
        this.showName = showName;
        this.createDate = createDate;
        this.creator = creator;
        this.startDate = startDate;
        this.endDate = endDate;
        this.cityId = cityId;
        this.isCancelled = isCancelled;
    }

    public Integer getShowId()
    {
        return showId;
    }

    public void setShowId( Integer showId )
    {
        this.showId = showId;
    }

    public int getEventId()
    {
        return eventId;
    }

    public void setEventId( int eventId )
    {
        this.eventId = eventId;
    }

    public String getShowName()
    {
        return showName;
    }

    public void setShowName( String showName )
    {
        this.showName = showName;
    }

    public Date getCreateDate()
    {
        return createDate;
    }

    public void setCreateDate( Date createDate )
    {
        this.createDate = createDate;
    }

    public int getCreator()
    {
        return creator;
    }

    public void setCreator( int creator )
    {
        this.creator = creator;
    }

    public Date getStartDate()
    {
        return startDate;
    }

    public void setStartDate( Date startDate )
    {
        this.startDate = startDate;
    }

    public Date getEndDate()
    {
        return endDate;
    }

    public void setEndDate( Date endDate )
    {
        this.endDate = endDate;
    }

    public int getCityId()
    {
        return cityId;
    }

    public void setCityId( int cityId )
    {
        this.cityId = cityId;
    }

    public boolean getIsCancelled()
    {
        return isCancelled;
    }

    public void setIsCancelled( boolean isCancelled )
    {
        this.isCancelled = isCancelled;
    }

    public String getShowDetails()
    {
        return showDetails;
    }

    public void setShowDetails( String showDetails )
    {
        this.showDetails = showDetails;
    }

    @Override
    public int hashCode()
    {
        int hash = 0;
        hash += ( showId != null ? showId.hashCode() : 0 );
        return hash;
    }

    @Override
    public boolean equals( Object object )
    {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if ( !( object instanceof S001_Show ) )
        {
            return false;
        }
        S001_Show other = (S001_Show) object;
        if ( ( this.showId == null && other.showId != null )
            || ( this.showId != null && !this.showId.equals( other.showId ) ) )
        {
            return false;
        }
        return true;
    }

    @Override
    public String toString()
    {
        return "Easyticket.dbo.[S001_SHOW][ showId=" + showId + " ]";
    }

}
